package com.starhub.domain.knowledge.result;

import java.util.List;

import com.starhub.domain.knowledge.vo.KnowledgeItemVo;

import lombok.Data;

/**
 * 知识条目搜索结果
 * @version: V1.0
 * @author: liuhf
 * @time 2025-06-05
 */
@Data
public class KnowledgeItemsSearchResult {
    /**
     * 知识条目列表
     */
    private List<KnowledgeItemVo> records;
    
    /**
     * 总记录数
     */
    private Long total;
    
    /**
     * 每页大小
     */
    private Long size;
    
    /**
     * 当前页码
     */
    private Long current;
    
    /**
     * 构建成功结果
     */
    public static KnowledgeItemsSearchResult success(List<KnowledgeItemVo> records, Long total, Long size, Long current) {
        KnowledgeItemsSearchResult result = new KnowledgeItemsSearchResult();
        result.setRecords(records);
        result.setTotal(total);
        result.setSize(size);
        result.setCurrent(current);
        return result;
    }
    
    /**
     * 构建失败结果
     */
    public static KnowledgeItemsSearchResult fail() {
        return new KnowledgeItemsSearchResult();
    }
}
